﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using SqlserverHelper;
using System.Threading;

using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using OJ;
using DLLmySQL;

/// <summary>
/// 实时查询
/// </summary>
public partial class saveOprtLog : System.Web.UI.Page
{

    public string strCnn = ConfigurationSettings.AppSettings["DataBaseString"];
    protected void Page_Load(object sender, EventArgs e)
    {
        string title = "";
        string path = "";

        string user_identity = "";
        string user_id = "";
        string content = "";
        string message = "";
        // title
        if (Request.Form["title"] != null && Request.Form["title"].ToString().Trim() != "")
        {
            title = Request.Form["title"].ToString();
        }

        // 页面路径
        if (Request.Form["path"] != null && Request.Form["path"].ToString().Trim() != "")
        {
            path = Request.Form["path"].ToString();
        }

        // 用户id
        if (Request.Form["user_id"] != null && Request.Form["user_id"].ToString().Trim() != "")
        {
            user_id = Request.Form["user_id"].ToString();
        }

        // 用户身份权限
        if (Request.Form["user_identity"] != null && Request.Form["user_identity"].ToString().Trim() != "")
        {
            user_identity = Request.Form["user_identity"].ToString();
        }

        // 
        if (Request.Form["content"] != null && Request.Form["content"].ToString().Trim() != "")
        {
            content = Request.Form["content"].ToString();
        }

        // 
        if (Request.Form["message"] != null && Request.Form["message"].ToString().Trim() != "")
        {
            message = Request.Form["message"].ToString();
        }


        string stResult = f_sell(title, path, user_id , user_identity,  content,  message);
        Response.Write(stResult);
    }

    public string f_sell(string title, string path, string user_id, string user_identity, string content, string message)
    {
        Define.retInfo ret = new Define.retInfo();
        try
        {

            LogBLL.Err("123 title=" + title + ",path=" + path + ",user_id=" + user_id + ",user_identity=" + user_identity);


            OperLog.log(title,path,user_id, user_identity,content,message);
            ret.code = 200;
            ret.msg = "success";

        }
        catch
        {
            ret.code = 20000;
            ret.msg = "服务不可用";
            ret.data = null;
        }

        return Ojson.ObjectToJson(ret);
    }
}